//==============================================================================
#include "CApp.h"

//==============================================================================
void CApp::OnEvent(SDL_Event* Event) {
    CEvent::OnEvent(Event);
}

//==============================================================================
void CApp::OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode) {
	switch(sym) {
		case SDLK_LEFT: {
			Player.MoveLeft = true;
			Player.MoveRight = false;
			Player.MoveUp = false;
			Player.MoveDown = false;
			break;
		}

		case SDLK_RIGHT: {
			Player.MoveRight = true;
			Player.MoveLeft = false;
			Player.MoveUp = false;
			Player.MoveDown = false;
			break;
		}
		case SDLK_UP: {
			Player.MoveUp = true;
			Player.MoveRight = false;
			Player.MoveLeft = false;
			Player.MoveDown = false;
			break;
		}
		case SDLK_DOWN: {
			Player.MoveDown = true;
			Player.MoveRight = false;
			Player.MoveUp = false;
			Player.MoveLeft = false;
			break;
		}

		case SDLK_SPACE: {
		    Player.OnPonerBomba();
		    break;
		}
		default: {
		}
	}
}
//------------------------------------------------------------------------------
/*void CApp::RevivirJugador(){
    if (Player.Inactive && Player.cantVidas>=0){
        CMap* Map =CArea::AreaControl.GetMap(1,1);
        t_posicion posSpawnJ = Map->SpawnJList.at(1);
        Player.OnLoad("izquierda.png", 64 ,128 ,8,0) ;
       Player.OnLoad("derecha.png", 64 ,128 ,8,1) ;
       Player.OnLoad("abajo.png", 64 ,128 ,8,2) ;
       Player.OnLoad("arriba.png", 64 ,128 ,8,3) ;


        Player.Revivir(posSpawnJ.X, posSpawnJ.Y);
        //Player.Revivir(posSpawnJ.X, posSpawnJ.Y);
        CObjetoAnimado::ObjectList.push_back(&Player);
    }
}*/
//------------------------------------------------------------------------------
void CApp::OnKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode) {
	switch(sym) {
		case SDLK_LEFT: {
			Player.MoveLeft = false;
			break;
		}
		case SDLK_RIGHT: {
			Player.MoveRight = false;
			break;
		}
        case SDLK_UP: {
			Player.MoveUp = false;
			break;
		}
		case SDLK_DOWN: {
			Player.MoveDown = false;
			break;
		}

		default: {
		}
	}
}

//------------------------------------------------------------------------------
void CApp::OnExit() {
	Running = false;
}
//==============================================================================
